package com.example.adminui.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.adminui.entity.Lead;
import com.example.adminui.mapper.LeadMapper;
import com.example.adminui.service.LeadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class LeadServiceImpl implements LeadService {
    @Autowired
    private LeadMapper leadMapper;

    @Override
    public List<Lead> getAllLeads() {
        return leadMapper.selectList(new QueryWrapper<>());
    }

    @Override
    public Lead getLeadById(Long id) {
        return leadMapper.selectById(id);
    }

    @Override
    public void createLead(Lead lead) {
        leadMapper.insert(lead);
    }

    @Override
    public void updateLead(Lead lead) {
        leadMapper.updateById(lead);
    }

    @Override
    public void deleteLead(Long id) {
        leadMapper.deleteById(id);
    }
}